<%-- 
    Document   : editworkProject
    Created on : Jul 28, 2012, 10:42:22 AM
    Author     : VANANH
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../css/kapiform.css"/> 
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/jq.date.js"></script>  
        <link rel="stylesheet" type="text/css" href="../css/ui.datepicker.css"/>
    </head>
    <script type="text/javascript">
        var open_cur = 0;
        $j = jQuery.noConflict();
        $j(document).ready(function(){
            $j(".saveN500").live("click",function(){
                var pn100=$j(this).parent().prev().children().children().children().children().next().children().next().val();
                 var hoten=$j(this).parent().prev().children().children().children().children().next().children().next().find("option:selected").text();
                
                var pn000=$j(this).parent().prev().children().children().children().children().children().next().next().next().val();
                var nv501=$j(this).parent().prev().children().children().children().next().children().children().next().val();
                var dateS=$j(this).parent().prev().children().children().children().next().next().children().children().children().children().next().val();
                var dateT=$j(this).parent().prev().children().children().children().next().next().children().children().children().next().children().next().val();
                 var h1=$j(this).parent().prev().children().children().children().next().next().children().next().children().next().val();
                  var h2=$j(this).parent().prev().children().children().children().next().next().children().next().children().next().next().next().val();
                   var h3=$j(this).parent().prev().children().children().children().next().next().children().next().children().next().next().next().next().next().val();
                    var h4=$j(this).parent().prev().children().children().children().next().next().children().next().children().next().next().next().next().next().next().next().val();
                var nameTo = $j(this).parent().prev().children().children().children().next().next().next().children().children().next().children().next().find("option:selected").text();
             //   alert(nameTo);
           //  showPleaseWait();
         //  alert(h1+h2+h3+h4);
             $j(".alert").text("Đang cập nhật...");
             $j(".alert").text("Đang cập nhật...");
             $j(".alert").text("Đang cập nhật...");
             $j(".alert").text("Đang cập nhật...");
             $j(".alert").text("Đang cập nhật...");$j(".alert").text("Đang cập nhật...");
             $j(".alert").text("Đang cập nhật...");
             if(h1==""){
                 h1=0;
             }
              if(h2==""){
                 h2=0;
             }
              if(h3==""){
                 h3=0;
             }
              if(h4==""){
                 h4=0;
             }
             
                if(pn100 != 0){
                    $j.post("actionCalendarEmp.jsp?action=addN500&PN100="+pn100+"&PN000="+pn000+"&NV051="+ nv501+"&DATES="+dateS+"&DATET="+dateT+"&nameMail="+nameTo+"&hoten="+hoten+"&h1="+h1+"&h2="+h2+"&h3="+h3+"&h4="+h4,function(data){
                       
                        if(data!= null){


                            $j(".alert").text("Cập nhật thành công");
                            window.location="detailCalender.jsp?action=datetoday&pageString=datetoday2&type=1";
                        //    hidePleaseWait();
                        }else{
                             $j(".alert").text("Cập nhật không thành công");
                           window.location="detailCalender.jsp?action=datetoday&pageString=datetoday2&type=1";
                        }
                    });
                }
            });
            
//            $j(".mailTo").live('change',function() {
//               
//                   var mailto = $j(this).find("option:selected").text();
//                alert(mailto);
//              
//               
//            });
          
            //  validateform("form-input-customer");
        });

    </script>
    <style type="text/css">
        #ui-datepicker-div
        {
            z-index: 9999999;
        }
        html{visible : true}


    </style>
    <script type="text/javascript">
        var open_cur = 0;
        $j = jQuery.noConflict();
        $j(document).ready(function(){             
            $j('input#dateStart, input#dateEnd').datepicker({ dateFormat: 'dd/mm/yy', showOn: 'button', buttonImage: '../images/calenda_icon.gif', buttonImageOnly: true }); 
            //           // $j('#timepicker').timepicker();
            //             //   $j('#timepicker2').timepicker();               
            //               // $j('.sumbitEmp').attr('disabled', true);
            //                $j("#dateEnd").live("change",function(){
            //                    var DateToValue = $j("#dateStart").val();
            //                    var DateFromValue = $j("#dateEnd").val();
            //                
            //                    if (Date.parse(DateToValue) <= Date.parse(DateFromValue)) {
            //                       $j(".alert").text("");
            //                         $j('.sumbitEmp').attr('disabled', false);
            //                    }else{
            //                          $j('.sumbitEmp').attr('disabled', true);
            //                      $j(".alert").text("Chú ý: Ngày h?t h?n l?n hon ngày c?p");
            //                    }
            //                });
            ////                $j("#dateStart").live("change",function(){
            ////                    var DateToValue = $j("#dateStart").val();
            ////                    var DateFromValue = $j("#dateEnd").val();
            ////                
            ////                    if (Date.parse(DateToValue) <= Date.parse(DateFromValue)) {
            ////                       $j(".alert").text("");
            ////                         $j('.sumbitEmp').attr('disabled', false);
            ////                    }else{
            ////                          $j('.sumbitEmp').attr('disabled', true);
            ////                      $j(".alert").text("Chú ý: Ngày h?t h?n l?n hon ngày c?p");
            ////                    }
            ////                });
        });
    </script>
    <style type="text/css">
        .bg_department{
            height: 68 !important;
        }

        .feild_sex tr td {
            float:left !important;
            width: 80px !important; 
            height: 20px;

        }
        .feild_sex tr td label {
            text-align: center !important;
            width: 88px !important; 
            color: black;
            margin-top: 20px;
            font-size: 12px;
            margin-left: -55px;
        }
        .feild_sex tr td input[type="radio"]{
            float:left !important;

        }
        .ui-datepicker-trigger1{
            cursor: pointer;
            position: absolute;
        }
        .itemimg{
            float:left;
            margin-top: -5px;
            width: 50%;

        }
        .field_normal{            
            width:100%; 
        }
        .field_pink{
            background-color: #D1E1F1; 

        }
        .lbl_editWork{
            float: left !important;
            width: 115px !important;
            /*  text-align:right !important;
              
              width: 95px !important;
              padding-top: 10px!important;
              padding-bottom: 0px; */

        }

        .date_editWork{
            width: 250px;
            float: left;
            margin-top: 8px;
        }
        img.ui-datepicker-trigger{
            margin-top: 3px !important;
        }
        .priority_work{
            width:370px;

            float:left;
            color: black;
        }
        .div_null{
            width: 290px;
            height: 20px;
            float: left;
        }

    </style>
    <f:view>
        <a4j:form id="form-input-customer" >
            <body style=" float:left; width:auto; height:auto; margin:0px;">
                <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>
                <div class="popup" style="height:480px; width:620px">
                    <div class="popup-header">
                        <div class="title"><h:outputText value="Nhân viên nghỉ phép"/></div>
                    </div>
                    <div class="popup-content">
                        <div class="main_content">
                            <div class="form_item_content" style="margin-top:15px; margin-left: 0px" >
                                <div class="item_content" style="display:block">
                                    <div class="field_pink" style="height:75px; " >
                                        <div class="fields_input" >  

                                            <%--    <label class="lbl_editWork" ><h:outputText value="Bộ phận"/>*: </label>
                                               <h:selectOneMenu id="comboboxS200" value="#{n500Controller.FN450}"  styleClass="cbx_editWork required" valueChangeListener="#{n500Controller.changeCombN450forN850}" >
                                                     <f:selectItem itemLabel="Vui lòng chọn" />
                                                    <f:selectItems value="#{n500Controller.combN450}" />
                                                    <a4j:support event="onchange" reRender="group" />
                                                </h:selectOneMenu>
                                            --%>
                                            <label class="lbl_editWork"><h:outputText value="Nhóm tổ"/>*: </label>                                          
                                            <h:selectOneMenu id="group" value="#{n500Controller.phongban}"  styleClass="cbx_editWork required"  valueChangeListener="#{n500Controller.changeCombN850forN100}">
                                                <f:selectItem itemLabel="Vui lòng chọn" />
                                                <f:selectItems value="#{n500Controller.combN850}" />

                                                <a4j:support event="onchange" reRender="group1"  />
                                            </h:selectOneMenu>




                                        </div>
                                        <div class="fields_input" >
                                            <label class="lbl_editWork"><h:outputText value="#{locale.employee}"/>*: </label>
                                            <h:selectOneMenu id="group1"  value="#{n500Controller.PN100}"  styleClass="cbx_editWork classFn100" >
                                                <f:selectItems value="#{n500Controller.combN100}" />

                                            </h:selectOneMenu>
                                            <label class="lbl_editWork"><h:outputText value="Hình thức nghỉ"/>*: </label>
                                            <h:selectOneMenu id="comboboxn5502" value="#{n500Controller.FN000}"  styleClass="cbx_editWork classFn000">   
                                                <f:selectItems value="#{n500Controller.combN000}" />
                                            </h:selectOneMenu>



                                        </div>
                                            
                                    </div>
                                    <div class="field_normal" style="height: 165px;">
                                        <div class="fields_input" >
                                            <label class="lbl_editWork"><h:outputText value="Lý do (ghi chú)"/><span>:</span>  </label>


                                            <h:inputTextarea value="#{n500Controller.nv502}" styleClass="classNv052" style="height:100px; width:455px; margin-left:1px ; margin-top: 10px" ></h:inputTextarea>
                                        </div>
                                    </div>
                                    <div class="field_pink" style="height: 65px; margin-top: 0px">

                                        <div class="fields_input">
                                            <div style="margin-top:-8px;">   
                                                <div class="date_editWork">
                                                    <label class="lbl_editWork" ><h:outputText value="Ngày nghỉ"/>: </label>
                                                    <input class="classndn501" style="width:90px; float: left;margin-left: 5px; " value="<h:outputText value="#{n500Controller.ndn501}"><f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText>" type="text" id="dateStart" name="dateStart" class="input_fields date"/>           
                                                </div>

                                                <div class="date_editWork">
                                                    <label class="lbl_editWork"><h:outputText value="Ngày hết phép"/>: </label>
                                                    <input class="classndn505" style="width:90px; float: left;margin-left: 5px;"  value="<h:outputText value="#{n500Controller.ndn505}"><f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText>" type="text" id="dateEnd" name="dateEnd" class="input_fields date"/>
                                                </div>
                                            </div>
                                        </div>
                                                  <div class="fields_input" >
                                            <label class="lbl_editWork"><h:outputText value="Giờ nghỉ"/>: </label>
                                            <h:inputText style="width:40px;float:left;margin-left:5px;" value=""/> <span style="float:left;">:</span> <h:inputText style="width:40px;float:left;" value=""/>
                                            <label style="margin-left: 35px;" class="lbl_editWork"><h:outputText value="đến"/>: </label>
                                              <h:inputText style="width:40px;float:left;margin-left:5px;" value=""/><span style="float:left;">:</span>  <h:inputText style="width:40px;float:left;" value=""/>



                                        </div>

                                    </div>
                                    <div class="field_pink" style="height: 30px;background-color: white; margin-top: 0px">

                                        <div class="fields_input">

                                            <div class="date_editWork" style="float: left; width: 47%;">
                                                <label class="lbl_editWork" ><h:outputText value="Mail gửi đi"/>: </label>
                                                <h:selectOneMenu value="#{m575Bean.mailsendId}" valueChangeListener="#{n500Controller.changeCombQ000}">
                                                    <f:selectItems value="#{m575Bean.listcomboQ000}" />    
                                                    <a4j:support event="onchange" />
                                                </h:selectOneMenu>
                                            </div>



                                            <div class="date_editWork" style="width: 48%; margin-right: 31px;">
                                                <label class="lbl_editWork" ><h:outputText value="Mail đến"/>: </label>
                                                <h:selectOneMenu id="abc" styleClass="mailTo" value="#{m575Bean.mailsendId}" >
                                                    <f:selectItems value="#{n500Controller.comN900}" />                                               
                                                </h:selectOneMenu>
                                            </div>



                                        </div>

                                    </div>


                                </div>   



                                                <h:panelGroup id="masaage"> <div class="alert"><h:outputText value="#{n500Controller.massage}"/></div>    </h:panelGroup>                                                           

                            </div>
                        </div>
                        <div class="popup-footer">
                           
                            <div class="buttonsave" onclick="parent.jQuery.fancybox.close(); " style="margin-right:31px;"  ><span><h:outputText value="#{locale.button_close}"/></span></div>
                            <div class="buttonsave saveN500"> <span style="float: left;margin-left: 20px;">Lưu</span>
                                <a4j:support event="onclick" reRender="masaage"/>
                            </div>                        
                        </div>

                    </div>          
            </body>
        </a4j:form>
    </f:view>
</html>
<script type="text/javascript">
    $j(document).ready(function(){
        yhight = ($j('.popup').height()-90)+"px" ;
        $j('.main_content').css('height',yhight );
        $j('.popup-content').css('height',yhight );
    });
</script>

